<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="driver-1.0.min.js"></script>
    <script type="text/javascript">
        driver.log(true, 5000).debug();
        window.addEventListener("load", function(){
            driver.open({
                name: "god",
                version:2,
                tables:[{name:"angale", indexes:[{name:"nameIndex", column:"name", unique:true}]}, "boy", "yesu"]
            });
        }, false);

        function insert(){
            driver.insert("angale", {"id": 3, "name": "33", "age": 10});
            driver.insert("angale", {"id": 4, "name": "44", "age": 10});
            driver.insert("angale", {"id": 5, "name": "55", "age": 10});
            driver.insert("angale", {"id": 6, "name": "66", "age": 10});
            driver.insert("angale", {"id": 7, "name": "77", "age": 10});
        }
        function selectTable(){
            driver.query("angale", function(result){
                console.log("query");
                console.log(result);
            });

            driver.fetch("angale", function(k, v){
                console.log("fetch");
                console.log(k);
                console.log(v);
            }, KeyRange.eq(4));
        }
        function index(){
            driver.getTable("angale").index("nameIndex", function(rs){console.log(rs);}, KeyRange.ALL_KEYS);
//            driver.multiple("angale", "nameIndex", function(k, rs){console.log(rs);});
        }
        function deleteRow(){
            driver.deleteRow("angale", 1);
        }
        function update(){

        }

    </script>
</head>
<body>
<input type="button" value="insert" onclick="insert();"/>
<input type="button" value="index" onclick="index();"/>
<input type="button" value="select" onclick="selectTable();"/>
<input type="button" value="deleteRow" onclick="deleteRow();"/>
<input type="button" value="update" onclick="update();"/>
</body>
</html>